﻿using SolarWinds.Shapes;

namespace SolarWinds.Actors
{
    using Microsoft.Xna.Framework;
    using JigLibX.Physics;
    using JigLibX.Collision;

    public class Actor
    {
        protected readonly Shape mShape;
        public Vector3 BodyPosition
        {
            get { return mBody.Position; }
        }

        public Quaternion BodyRotation
        {
            get
            {
                return Quaternion.CreateFromRotationMatrix(
                    mSkin.GetPrimitiveLocal(0).Transform.Orientation *
                    mBody.Orientation);
            }
        }

        private readonly Body mBody;
        public Body Body
        {
            get
            {
                return mBody;
            }
        }

        private readonly CollisionSkin mSkin;
        public CollisionSkin Skin
        {
            get
            {
                return mSkin;
            }
        }

        public Actor(Shape shape)
        {

            mBody = new Body();
            mBody.ExternalData = shape;
            mSkin = new CollisionSkin(Body);
            mBody.CollisionSkin = mSkin;

            mShape = shape;
        }
    }
}
